#include <stdio.h>
#include "list.h"

struct test {
    int id;
    struct list list;
};

int main(int argc, char *argv[])
{
    struct test a = {
        .id = 1,
    };

    struct test b = {
        .id = 2,
    };

    struct test c = {
        .id = 3,
    };

    list_init(&a.list);

    printf("list is empty: %d\n", list_is_empty(&a.list));
    list_add_tail(&a.list, &b.list);
    list_add_tail(&a.list, &c.list);
    printf("list is empty: %d\n", list_is_empty(&a.list));

    struct list *iter;
    list_for_each(iter, &a.list) {
        printf("iter.id=%d\n", list_entry(iter, struct test, list)->id);
    }

    printf("list size: %d\n", list_size(&a.list));
    printf("list size: %d\n", list_size(&b.list));
    return 0;
}

